<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script>
        /*
            js 构造函数和原型方法中的this ， 指向与当前构造函数创建的实例对象
        */
        var  Vue = function(options){
            this._init(options);  
        }
        Vue.prototype._init = function(options){
            if(typeof options.data == "function"){
                this.data = options.data();
            }else{
                this.data = options.data;
            }
        }

        var options1 = {
            data:{
                msg:"测试数据"
            }
        }

        var v1 = new Vue(options1);
        var v2 = new Vue(options1);

        var options2 = {
            data:function(){
                return {
                    msg:"测试数据"
                }
            }
        }

        var v3 = new Vue(options2);
        var v4 = new Vue(options2);

        // JS的方法代码执行时机
        function show(){
            console.log("show");
        }
    </script>
</head>
<body>
    
</body>
</html>